package mn.more.wits.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import mn.more.wits.client.dto.Handshake;

public interface ServiceInit extends RemoteService {

	/**
	 * Utility/Convenience class. Use ServiceInit.App.getInstance() to access
	 * static instance of ServiceInitAsync
	 */
	class App {

		private static ServiceInitAsync ourInstance = null;

		public static synchronized ServiceInitAsync getInstance() {
			if (ourInstance == null) {
				ourInstance = (ServiceInitAsync) GWT.create(ServiceInit.class);
				((ServiceDefTarget) ourInstance).setServiceEntryPoint(GWT.getModuleBaseURL() + "rpc/handshake");
			}
			return ourInstance;
		}
	}

	Handshake init(String appName);
}
